﻿using System;

namespace _018.属性
{
	class Customer
	{
		// 数据成员
		private string name;
		private int age;
		//private string address;
		private string createTime;

		//public void SetAge(int age)
		//{
		//	this.age = age;
		//}
		//public int GetAge() { return this.age; }

		// 属性访问

		public int Age
		{
			get
			{
				return age;
			}
			set // value参数
			{
				if (value < 0) { return; }
				age = value;
			}
		}

		// 简写
		public string Name
		{
			get; set;
		}

		// 自动创建 private string address;成员
		public string Address { get; set; }

		public void show()
		{
			Console.WriteLine("名字：" + name);
			Console.WriteLine("年龄：" + age);
			Console.WriteLine("地址：" + Address);
			Console.WriteLine("创建时间：" + createTime);
		}
	}
}
